home *** CD-ROM | disk | FTP | other *** search
/ Super PC 31 / Super PC 31 (Shareware).iso / spc / inter / speakf / fuente / ulaw.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-13  |  535 b   |  19 lines

  1. /*
  2.  
  3.     Mu-law to linear conversion
  4.  
  5. */
  6.  
  7. extern unsigned short FAR u2s[];
  8. extern unsigned char FAR s2u[];
  9.  
  10. #define audio_u2s(x)  ((short) (u2s[(unsigned  char) (x)]))
  11. #define audio_s2u(x)  (s2u[((unsigned short) (x)) >> 3])
  12.  
  13. /* Note that 8 bit PCM samples are unsigned, with 0x80
  14.    representing the zero crossing and 0x0 and 0xFF the
  15.    extrema. */
  16.  
  17. #define audio_u2c(x)   (0x80 + ((unsigned char) (u2s[(unsigned  char) (x)] >> 8)))
  18. #define audio_c2u(x)  (s2u[(((short) ((((char) (x)) - 0x80) & 0xFF)) << 5) + 0xF])
  19.